﻿using System;

// 重写demo2-1
struct Books
{
    private string title;

    private string author;

    private string subject;

    private int book_id;

    public void getValues(string t, string a, string s, int id)
    {
        title = t;
        author = a;
        subject = s;
        book_id = id;
    }

    public void display()
    {
        Console.WriteLine("Title : {0}", title);
        Console.WriteLine("Author : {0}", author);
        Console.WriteLine("Subject : {0}", subject);
        Console.WriteLine("Book_id :{0}", book_id);
    }
}

namespace demo2_2
{
    class Program
    {
        public static void Main(string[] args)
        {
            Books Book1 = new Books(); /* 声明 Book1，类型为 Book */
            Books Book2 = new Books(); /* 声明 Book2，类型为 Book */

            /* book 1 详述 */
            Book1
                .getValues("C Programming",
                "Nuha Ali",
                "C Programming Tutorial",
                6495407);

            /* book 2 详述 */
            Book2
                .getValues("Telecom Billing",
                "Zara Ali",
                "Telecom Billing Tutorial",
                6495700);

            /* 打印 Book1 信息 */
            Book1.display();

            /* 打印 Book2 信息 */
            Book2.display();

            Console.ReadKey();
        }
    }
}
// 类和结构有以下几个基本的不同点：
//     类是引用类型，结构是值类型。
//     结构不支持继承。
//     结构不能声明默认的构造函数
